﻿using System.IO;
using UnityEngine;

namespace Devil
{
    [Platform(RuntimePlatform.WindowsEditor)]
    [Platform(RuntimePlatform.WindowsPlayer)]
    public class PCFileSystem : NativeFileSystem
    {

        protected override Stream GetFileStream(string path, FileMode mode, FileAccess access)
        {
            return File.Open(path, mode, access);
        }

        protected override bool NativeExistDirectory(string path)
        {
            return Directory.Exists(path);
        }

        protected override bool NativeExistFile(string path)
        {
            return File.Exists(path);
        }

        protected override void NativeMakeDirectory(string path)
        {
            Directory.CreateDirectory(path);
        }

        protected override void NativeDeleteFile(string path)
        {
            if (File.Exists(path))
                File.Delete(path);
        }

        protected override void NativeMoveFile(string from, string to)
        {
            File.Move(from, to);
        }

        protected override void OnBecomeActive()
        {
        }

        protected override void OnDestroy()
        {
        }
    }
}